<?php

/**
 * Upload file wrapper for 
 *
 */
class phpinchains_util_UploadFile {
    
    private $filename = "";
    private $type = "";
    private $tempName = "";
    private $error = 0;
    private $size = 0;
    
    /**
     * Constructor
     *
     * @param array $file File array as used in $_FILE
     */
    public function phpinchains_util_UploadFile ($file) {
        $this->filename = $file['name'];
        $this->type     = $file['type'];
        $this->tempName = $file['tmp_name'];
        $this->path     = $this->tempName;
        $this->error    = $file['error'];
        $this->size     = $file['size'];
    }
    
    public function getName () {
        return $this->name;
    }
    
    public function getType () {
        return $this->type;
    }
    
    public function getTempName () {
        return $this->tempName;
    }
    
    public function getPath () {
        return $this->path;
    }
    
    public function getError () {
        return $this->errror;
    }
    
    public function getSize () {
        return $this->size;
    }
    
    public function getImageSize () {
    	$size = getimagesize($this->getPath());
    	$size['width']  = $size[0]; 
    	$size['height'] = $size[1]; 
    }
    
    public function copyTo ($dest) {
    	$check = copy($this->getPath(), $dest);
    	if ($check) {
    		$this->path = $dest;
    	}
    	return $check;
    }
    
}

?>